package com.atguigu.staservice.controller;


import com.atguigu.commonutils.R;
import com.atguigu.staservice.service.StatisticsDailyService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.Map;

/**
 * <p>
 * 网站统计日数据 前端控制器
 * </p>
 *
 * @author hwt
 * @since 2022-10-03
 */
@RestController
@RequestMapping("staservice/daily")
public class StatisticsDailyController {
    @Resource
    StatisticsDailyService service;

    @PostMapping("registerCount/{day}")
    public R countRegister(@PathVariable("day") String day) {
        service.countRegister(day);
        return R.ok();
    }

    @GetMapping("showData/{type}/{begin}/{end}")
    public R showData(@PathVariable("type") String type,
                      @PathVariable("begin") String begin,
                      @PathVariable("end") String end) {

        Map<String, Object> map = service.getShowData(type, begin, end);

        return R.ok().data(map);
    }


}

